#include "filter_interface.h"
#include <iostream>

FilterInterface::FilterInterface()
{

}



FilterInterface::~FilterInterface()
{

}


FilterInterface::getInstance()
{
	static FilterInterface singleton;
	return &singleton;
}

bool FilterInterface::processConfig(char* path)
{
	return false;
}


bool FilterInterface::processReply(HttpStateData * reply) 
{
	unsigned int size= request->readBuf->contentSize();
	char *data=request->readBuf->content();
	for(int i=0;i<reply_list.size;i++)
	{
		reply_list.at(i)->process(data,size);
	}
	
	return true;
}


bool FilterInterface::processRequest(HttpStateData * request)
{
	unsigned int size= request->readBuf->contentSize();
	char *data=request->readBuf->content();
	for(int i=0;i<reply_list.size;i++)
	{
		reply_list.at(i)->process(data,size);
	}
	
	return true;
}

bool FilterInterface::addFilter(AbstractFilter * filter) 
{
	reply_list.push_back(filter);
	return true;
}


bool FilterInterface::registerFilter(char *filterName) 
{
	return false;
}